// ReactDOM.createRoot(root).render(<App/>)

import {
	createContainer,
	updateContainer
} from '@/react-reconciler/fiberReconciler';
import { ReactElementType } from '@/shared/ReactTypes';
import { Container } from './hostConfig';
import { initEvent } from './SyntheticEvent';


// container 是挂载的根节点的dom容器
export function createRoot(container: Container) {
	// root是FiberRootNode节点 
	const root = createContainer(container);
	
	return {
		// element是根节点react组件
		render(element: ReactElementType) {
			initEvent(container, 'click');
			// 
			return updateContainer(element, root);
		}
	};
}
